package com.example.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.example.common.valid.AddGroup;
import com.example.common.valid.UpdateGroup;
import com.example.common.valid.annotation.ListValue;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author zyred
 * @email zyred@163.com
 * @date 2021-08-23 10:31:18
 */
@Data
@TableName("pms_brand")
@Accessors(chain = true)
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@TableId
    @Null(message = "新增时不能输入ID", groups = {AddGroup.class})
    @NotNull(message = "ID不能为空", groups = {UpdateGroup.class})
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名不能为空", groups = {UpdateGroup.class, AddGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@URL(message = "品牌logo地址不合法", groups = {UpdateGroup.class, AddGroup.class})
    @NotBlank(message = "品牌名不能为空", groups = {UpdateGroup.class, AddGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
     * 自定义校验逻辑
	 */
    @ListValue(vals = {0, 1}, groups = {UpdateGroup.class, AddGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@NotBlank(message = "检索首字母不能为空", groups = {UpdateGroup.class, AddGroup.class})
	@Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母只能是一个字母", groups = {UpdateGroup.class, AddGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
    @NotNull(message = "排序不能为空", groups = {UpdateGroup.class, AddGroup.class})
    @Min(value = 0, message = "排序不能小于0", groups = {UpdateGroup.class, AddGroup.class})
	private Integer sort;

}
